package babo;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Scanner; 

public class EchoClient {
	
	public static void main(String[] args) throws Exception{
		
		Socket socket = new Socket("localhost",8112);
		System.out.println("서버 연결 완료");
		
		OutputStream out = socket.getOutputStream();
		DataOutputStream dos = new DataOutputStream(out);
		
		Scanner scanner = new Scanner(System.in);
		while(true)
		{
		System.out.println("서버로 전송할 메시지를 입력해주세요");
		String msg = scanner.nextLine();
		dos.writeUTF(msg);
		dos.flush();
		
		if(msg.equals("EXIT"))
		{
			break;
		}
		}
		dos.close();
		out.close();
		socket.close();
	}
}
